package org.arch_learn.io.nio.bytebuffer;

import java.nio.ByteBuffer;

/**
 * 演示初始化缓冲区
 */
public class InitByteBufferDemo {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(5);
        for (int i = 0; i < 5; i++) {
            System.out.println(byteBuffer.get());
        }

        ByteBuffer byteBufferWrapper = ByteBuffer.wrap("demo".getBytes());
        for (int i = 0; i < 4; i++) {
            System.out.println(byteBufferWrapper.get());
        }
    }
}
